

//############楼层标签1


Comps.FloorLable = function(option) {
    this.compId = option.compId;
    this.needAsyncInit = option.needAsyncInit;
    this.lableName = option.lableName;
    this.floorName=option.floorName;
}

Comps.FloorLable.prototype.init = function(){

	var that = this;

	  if (this.needAsyncInit) {
          $.ajax({
              type: "GET",
              url: ContextPath+"/floorLableComp/ajaxLoadData",
              data: {
                  "lableName": that.lableName,
                  "floorName": that.floorName
              },
              dataType: "json",
              async: true,
              success: function(data) {
                  $("#" + that.compId + "_lablename").text(data.lableName);
                  $("#" + that.compId + "_span").text(data.floorName);

                  Utils.ajaxLoadComplate(that);
              }
          })
      }
	  else {
          Utils.ajaxLoadComplate(that);

	  }

}


//############楼层标签



//###########推荐商品##########2
Comps.RecommendProduct = function(option){
	this.compId = option.compId;
	this.productUuid = option.param_inProductUuids;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName = option.lableName;
	this.productUrl=option.productUrl;
}


Comps.RecommendProduct.prototype.init=function(){

	var that=this;

	if(this.needAsyncInit){


		$.ajax({
			  type: "GET",
	      url: ContextPath+"/recommendProductComp/ajaxLoadData",
	      data: {productUuid:that.productUuid, lableName:that.lableName},
	      dataType: "json",
	      async:true,
	      success: function(data){

	    	var listdata=  data.rows;


	    	$(".j_recommendproduct_lable").html(data.lableName);

		    var oneProductHtml=	$(".j_recommendproduct_list").eq(0).clone();


		    $(".j_recommendproduct_all").html('');

	    	for(var i=0;i<listdata.length;i++){


	    		oneProductHtml.find("img").attr("src",listdata[i].imgsrc);
	    		oneProductHtml.find("div.j_recommendproduct_title").text(listdata[i].name);

	    		oneProductHtml.find("div.j_recommendproduct_title").attr("uuid",listdata[i].productUuid);
	    		oneProductHtml.find("div.j_recommendproduct_price").text("￥"+listdata[i].price);
	   		 	$(".j_recommendproduct_all").append(oneProductHtml[0].outerHTML);


	    	}

	    	that.bindSomeEvent();
            Utils.ajaxLoadComplate(that);


	               }


		})

	}

	else {
    	that.bindSomeEvent();
        Utils.ajaxLoadComplate(that);


	}

}

Comps.RecommendProduct.prototype.bindSomeEvent=function(){

	var that=this;


	$(".j_recommendproduct_list").each(function(){


		$(this).bind("click",function(){

			var uuid=$(this).find("div.j_recommendproduct_title").attr("uuid");


			window.open(ContextPath+that.productUrl+"&productUuid="+uuid);

		})

	})


}

//###########推荐商品##########

//###########推荐店铺商品##########3


Comps.RecommendShopProduct = function(option){
	this.compId = option.compId;
	this.productUuid = option.param_inProductUuids;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName = option.lableName;
	this.productUrl=option.productUrl;
}


Comps.RecommendShopProduct.prototype.init=function(){

	var that =this;

	if(this.needAsyncInit){


		$.ajax({
			  type: "GET",
	      url: ContextPath+"/recommendShopProductComp/ajaxLoadData",
	      data: {productUuid:this.productUuid, lableName:this.lableName},
	      dataType: "json",
	      async:true,
	      success: function(data){

	    	var listdata=  data.rows;


	    	$(".j_recommendshopproduct_lable").html(data.lableName);

		    var oneProductHtml=	$(".j_recommendshopproduct_list").eq(0).clone();


		    $(".j_recommendshopproduct_all").html('');

	    	for(var i=0;i<listdata.length;i++){



	    		oneProductHtml.find("img").attr("src",listdata[i].imgsrc);
	    		oneProductHtml.find("div.j_recommendshopproduct_title").text(listdata[i].name);

	    		oneProductHtml.find("div.j_recommendshopproduct_title").attr("uuid",listdata[i].productUuid);
	    		oneProductHtml.find("div.j_recommendshopproduct_price").text("￥"+listdata[i].price);
	   		 	$(".j_recommendshopproduct_all").append(oneProductHtml[0].outerHTML);





	    	}

	    	that.bindSomeEvent();

            Utils.ajaxLoadComplate(that);

	               }


		})

	}

	else {

    	that.bindSomeEvent();
        Utils.ajaxLoadComplate(that);

	}

}

Comps.RecommendShopProduct.prototype.bindSomeEvent=function(){

	var that=this;


	$(".j_recommendshopproduct_list").each(function(){


		$(this).bind("click",function(){

			var uuid=$(this).find("div.j_recommendshopproduct_title").attr("uuid");


			window.open(that.productUrl+"&productUuid="+uuid);

		})





	})


}



//###########推荐店铺商品##########


//###########推荐店铺##########4



//组件定义
Comps.RecommendShop = function(option){
	this.compId = option.compId;
	this.shopUuid = option.param_inShopUuids;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName = option.lableName;
	this.shopUrl=option.shopUrl;
}


//初始化方法
Comps.RecommendShop.prototype.init=function(){


	var that=this;

	if(this.needAsyncInit){

		$.ajax({
			  type: "GET",
	      url: ContextPath+"/recommendShopComp/ajaxLoadData",
	      data: {shopUuid:that.shopUuid, lableName:that.lableName},
	      dataType: "json",
	      async:true,
	      success: function(data){

	    	var listdata=  data.rows;


	    	$(".j_recommendshop_lable").html(data.lableName);

		    var oneShopHtml=	$(".j_recommendshop_list").eq(0).clone();


		    $(".j_recommendshop_all").html('');

	    	for(var i=0;i<listdata.length;i++){





	    		oneShopHtml.find(".j_recommendshop_img").attr("src",listdata[i].logoUrl);

	    		oneShopHtml.find(".j_recommendshop_name").text(listdata[i].name);


	    		oneShopHtml.find(".j_recommendshop_name").attr("uuid",listdata[i].shopUuid);

	    		oneShopHtml.find(".j_recommendshop_conduct").text(listdata[i].conduct);


	         	$(".j_recommendshop_all").append(oneShopHtml[0].outerHTML);
	    	}

	    	that.bindSomeEvent();

            Utils.ajaxLoadComplate(that);



	               }




		})



	}

	else {

    	that.bindSomeEvent();
        Utils.ajaxLoadComplate(that);

	}


}



//绑定事件
Comps.RecommendShop.prototype.bindSomeEvent=function(){

	var that=this;


	$(".j_recommendshop_list").each(function(){


		$(this).bind("click",function(){

			var uuid=$(this).find("div.j_recommendshop_name").attr("uuid");


			window.open(that.shopUrl+"&shopUuid="+uuid);

		})






	})


}


//###########推荐店铺##########

//###########商品收藏##########5


Comps.CollectionProduct = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName = option.lableName;

	this.imgSrc=option.imgSrc;

	this.topic=option.topic;

	this.collectProductUrl=option.collectProductUrl
}




Comps.CollectionProduct.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}


// 初始化方法
Comps.CollectionProduct.prototype.init = function() {
	var that=this;
	var productUuid=that.GetQueryString("productUuid");
	if (this.needAsyncInit) {
		$.ajax({
			type : "GET",
			url : ContextPath+"/collectionProductComp/ajaxLoadData",
			data : {
				lableName : that.lableName,
				imgSrc:that.imgSrc
			},
			dataType : "json",
			async : true,
			success : function(data) {

				if(data.imgSrc!=""){
					$("#"+that.compId+"_collectionproduct_img").attr("src", data.imgSrc);
				}
				$("#"+that.compId+"_collectionproduct_span").text(data.lableName);
	            Utils.ajaxLoadComplate(that);
	            that.bindSomeEvent();
			}

		})
	}
	else {
        that.bindSomeEvent();
        Utils.ajaxLoadComplate(that);
	}
}

Comps.CollectionProduct.prototype.collectProduct=function(uuid){
	
	

	var that=this;


	var url = ContextPath+"/collectionProductComp/collectProduct";
	
	
	 var returnMessage = $("#"+this.compId+"_returnMessage");
	    var collectNum = $("#"+this.compId+"_collectNum");
	    var collectUrl = $("#"+this.compId+"_collectUrl");

	$.ajax({
		type : "GET",
		url : url,
		data : {
			productUuid : uuid,
			ranNum : Math.random()
		},
		dataType : "json",
		async : true,
		success : function(data) {


			var msg="";

			if(data.state=="1"){

				msg="收藏成功!";

			}
			else if (data.state=="2"){

				msg="收藏失败!";

			}

			else if (data.state=="3"){

				msg="您已经收藏过该商品了!";

			}
			returnMessage.html(msg);
			
			collectNum.html(data.count);
			
			collectUrl.attr("href",ContextPath+that.collectProductUrl);
			
			 $("#"+that.compId+"_modal-collect-form").modal('show');
			 
		        that.bindSomeEvent();

			Utils.ajaxLoadComplate(that);
		}

	})



}






Comps.CollectionProduct.prototype.bindSomeEvent=function(){

	var that=this;


	var productUuid=that.GetQueryString("productUuid");

	$("#"+that.compId+"_collectionproduct_a").click(function() {


		CompMessage.publish(that.topic,'',function(data){

			that.collectProduct(productUuid);
		});




	})


}






//###########商品收藏##########


//###########店铺收藏##########6


Comps.CollectionShop = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName = option.lableName;
	this.topic=option.topic;
	this.imgSrc=option.imgSrc;
	this.collectShopUrl=option.collectShopUrl;
}




Comps.CollectionShop.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}


// 初始化方法
Comps.CollectionShop.prototype.init = function() {

	var that=this;

	var productUuid=that.GetQueryString("shopUuid");

	if (this.needAsyncInit) {


		$.ajax({
			type : "GET",
			url : ContextPath+"/collectionShopComp/ajaxLoadData",
			data : {
				lableName : that.lableName,
				imgSrc:that.imgSrc
			},
			dataType : "json",
			async : true,
			success : function(data) {

				$("#"+that.compId+"_collectionshop_img").attr("src", data.imgSrc);

				$("#"+that.compId+"_collectionshop_span").text(data.lableName);
		        that.bindSomeEvent();


	            Utils.ajaxLoadComplate(that);

			}

		})


	}

	else {
        that.bindSomeEvent();

        Utils.ajaxLoadComplate(that);

	}





}

Comps.CollectionShop.prototype.collectShop=function(uuid){

	var that=this;
	var url = ContextPath+"/collectionShopComp/collectShop";
	

	 var returnMessage = $("#"+this.compId+"_returnMessage");
	    var collectNum = $("#"+this.compId+"_collectNum");
	    var collectUrl = $("#"+this.compId+"_collectUrl");

	$.ajax({
		type : "GET",
		url : url,
		data : {
			
			"type":"reputation",
			shopUuid : uuid,
			ranNum : Math.random()
		},
		dataType : "json",
		async : true,
		success : function(data) {



			var msg="";

			if(data.state=="1"){

				msg="收藏成功!";

			}
			else if (data.state=="2"){

				msg="收藏失败!";

			}

			else if (data.state=="3"){

				msg="您已经收藏过该店铺了!";

			}
			returnMessage.html(msg);
			
			collectNum.html(data.count);
			
			collectUrl.attr("href",ContextPath+that.collectShopUrl);
			
			 $("#"+that.compId+"_modal-collect-form").modal('show');
			Utils.ajaxLoadComplate(that);
		}

	})

}

Comps.CollectionShop.prototype.bindSomeEvent=function(){

	var that=this;


	var shopUuid=that.GetQueryString("shopUuid");

	$("#"+that.compId+"_collectionshop_a").click(function() {

		CompMessage.publish(that.topic,'',function(data){

			that.collectShop(shopUuid);
		});


	})


}



//###########店铺收藏##########



//###########栏目导航##########7


// 组件定义
Comps.ColumnNavigation = function(option) {
    this.compId = option.compId;
    this.needAsyncInit = option.needAsyncInit;
    this.categoryUuid = option.categoryUuid;
}

Comps.ColumnNavigation.prototype.bindSomeEvent = function() {
    var contentUuid= this.GetQueryString("contentUuid");
    
    

	

    for (var x = 0; x < 15; x++) {

        for (var y = 0; y < 15; y++) {
        	
        var uuid=	$("#" + this.compId + "columnnavigation_thirdtitle" + x + "" + y).attr("uuid");
        var contentSelect=	$("#" + this.compId + "columnnavigation_thirdtitle" + x + "" + y).attr("content");
        
        
        if(uuid==contentUuid){
        	
    		$("#help-breadcrumb").html(contentSelect);
        	
        }

            $("#" + this.compId + "columnnavigation_thirdtitle" + x + "" + y).click(function() {
            	
            	var content = $(this).attr("content");
            	
            	
         
            	if($.trim(content).startWith("http:")){
                	
                	window.open(content);
                }
                else {
                    $("#help-breadcrumb").html(content);

                	
                }

                
                
                

            
            })

        }
    }

}

String.prototype.startWith=function(str){     
	  var reg=new RegExp("^"+str);     
	  return reg.test(this);        
	}  

Comps.ColumnNavigation.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}

Comps.ColumnNavigation.prototype.init = function() {

    var that = this;

    var contentUuid= that.GetQueryString("contentUuid");


    if (this.needAsyncInit) {

        $.ajax({
            type: "GET",
            url: ContextPath+"/columnNavigationComp/ajaxLoadData",
            data: {
                categoryUuid: that.categoryUuid
            },
            dataType: "json",
            async: true,
            success: function(data) {

                $("#help-breadcrumb").html("");

                var parentHtml = $("#" + that.compId + "_columnnavigation_panelgroup");

                // 克隆节点
                var oneHtml = $("#" + that.compId + "_columnnavigation_panel").clone();

                // 移除模板数据
                $("#" + that.compId + "_columnnavigation_panel").remove();
                
                console.log(data)

                $.each(data,
                function(index, data3) {
                	
                    console.log(data3.key.categoryName)


                    oneHtml.find(".columnnavigation_sencondtitle").text(data3.key.categoryName);

                    oneHtml.attr("id", that.compId + "_columnnavigation_panel" + (index + 1));

                    parentHtml.append(oneHtml[0].outerHTML);

                    var newHtml = parentHtml.find("#" + that.compId + "_columnnavigation_panel" + (index + 1));

                    newHtml.find(".columnnavigation_span_toggle").attr("data-target", "#panel" + index);
                    newHtml.find(".columnnavigation_toggle").attr("id", "panel" + index);


                    var secondParentEle = newHtml.find(".columnnavigation_ul");

                    var secondClonetEle = newHtml.find(".columnnavigation_li").clone();

                    secondParentEle.find(".columnnavigation_li").remove();

                  //  newHtml.remove();

                    $.each(data3.value,
                    function(index2, data2) {

                        secondClonetEle.find(".columnnavigation_thirdtitle").attr("id", that.compId + "columnnavigation_thirdtitle" + index + index2)

                        secondClonetEle.find(".columnnavigation_thirdtitle").text(data2.contentTitle);
                        secondClonetEle.find(".columnnavigation_thirdtitle").attr("content", data2.contentValue);

                        secondParentEle.append(secondClonetEle[0].outerHTML);





                        if(contentUuid){

                        	if(contentUuid==data2.contentUuid){

                                $("#help-breadcrumb").html(data2.contentValue);



                        	}

                        }
                        else {

                        	if(index2==0&&index==0){
                        		 $("#help-breadcrumb").html(data2.contentValue);
                        	}


                        }




                        $("#" + that.compId + "columnnavigation_thirdtitle" + index + index2).bind("click",
                        function() {

                            var content = $(this).attr("content");

                            if (content && content != "") {

                                
                                if($.trim(content).startWith("http:")){
                                	
                                	window.open(content);
                                }
                                else {
                                    $("#help-breadcrumb").html(content);

                                	
                                }
                                
                                

                            } 

                        });

                    })

                })

                Utils.ajaxLoadComplate(that);

            }

        })

    }

    else {
    	that.bindSomeEvent();

        Utils.ajaxLoadComplate(that);

    }

}


//###########栏目导航##########






//###########图文编辑器##########8


Comps.ImageTextEditor = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.defineWidth = option.defineWidth;
	this.defineHeight = option.defineHeight;
	this.content=option.content;

}



Comps.ImageTextEditor.prototype.init = function() {

	var that =this;


	if (this.needAsyncInit) {



$("#"+that.compId+"_content").height(that.defineHeight);
$("#"+that.compId+"_content").width(that.defineWidth);




$("#"+that.compId+"_content").html(decodeURI(that.content));



	}

    Utils.ajaxLoadComplate(that);





}
//###########图文编辑器##########



//###########图片广告##########9



Comps.PictureAd = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.imgSrc = option.imgSrc;
	this.defineUrl = option.defineUrl;
	this.defineWidth = option.defineWidth;
	this.defineHeight = option.defineHeight;
	this.alt = option.alt;
}

Comps.PictureAd.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}


Comps.PictureAd.prototype.init = function() {
    var that =this;

	if (this.needAsyncInit) {

        $("#"+that.compId+"_img").attr("src",that.imgSrc);

        if(that.defineWidth != 0){
            $("#"+that.compId+"_img").attr("width",that.defineWidth);
        }

        if(that.defineHeight != 0){
            $("#"+that.compId+"_img").attr("height",that.defineHeight);
        }

         $("#"+that.compId+"_img").attr("alt",that.alt);
	}

	that.bindSomeEvent();
    Utils.ajaxLoadComplate(that);
}


Comps.PictureAd.prototype.bindSomeEvent=function(){

	var that=this;

	$("#"+that.compId+"_a").click(function(){
        if(that.defineUrl != "" && that.defineUrl != null){
		    window.open(ContextPath+that.defineUrl);
        }

	})
}



//###########图片广告##########




//###########二维码##########10




Comps.Qrcode = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.imgSrc = option.imgSrc;
	this.defineUrl = option.defineUrl;
	this.defineWidth = option.defineWidth;
	this.defineHeight = option.defineHeight;
	this.qrtype = option.qrtype;
	this.productUrl=option.productUrl;
	this.shopUrl=option.shopUrl;

}

Comps.Qrcode.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}


Comps.Qrcode.prototype.init = function() {

	var that =this;

	var url="";

	if(that.qrtype=="define"){
		url=that.defineUrl;


	}
	if(that.qrtype=="product"){

		var productUuid=	that.GetQueryString("productUuid");

		url=that.productUrl+"&productUuid="+productUuid


	}
	if(that.qrtype=="shop"){

		var shopUuid=	that.GetQueryString("shopUuid");


		url=that.shopUrl+"&shopUuid="+shopUuid


	}




	if (this.needAsyncInit) {

		$.ajax({
			type : "GET",
			url : ContextPath+"/qrCodeComp/ajaxLoadData",
			data : {
				imgSrc : that.imgSrc,
				defineWidth:that.defineWidth,
				defineHeight:that.defineHeight,
				defineUrl:url,
				qrtype:that.qrtype
			},
			dataType : "json",
			async : true,
			success : function(data) {

				url=escape(url);

				$("#"+that.compId+"_qrcode_codeimg").attr("src",ContextPath+"/qrCodeComp/createQrCode?defineWidth="+that.defineWidth+"&defineHeight="+that.defineHeight+"&imgSrc="+that.imgSrc+"&defineUrl="+url)
					
				if(that.defineWidth!=""&&that.defineWidth>0){
					
					$("#"+that.compId+"_qrcode_codeimg").attr("width",that.defineWidth);
					$("#"+that.compId+"_qrcode_codeimg").attr("height",that.defineHeight);
				}
				

				Utils.ajaxLoadComplate(that);
			}

		})

	}
	else {
		Utils.ajaxLoadComplate(that);

	}


}


Comps.Qrcode.prototype.bindSomeEvent=function(){

	$(".j_qrcode_codeimg").css("display","none");

	$(".j_qrcode_img").bind("mouseover",function(){



		$(".j_qrcode_codeimg").css("display","block");


	}).bind("mouseleave",function(){


		$(".j_qrcode_codeimg").css("display","none");


	})



}



//###########二维码##########



//###########信誉##########11


//组件定义
Comps.Reputation = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName=option.lableName;
	this.collectShopUrl=option.collectShopUrl;
	this.topic=option.topic;
}


Comps.Reputation.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}



Comps.Reputation.prototype.init = function() {

	var that = this;

	var productUuid=this.GetQueryString("productUuid");

	if (this.needAsyncInit) {

		$.ajax({
			type : "GET",
			url : ContextPath+"/reputationComp/ajaxLoadData",
			data : {
				productUuid : productUuid,
				lableName : that.lableName
			},
			dataType : "json",
			async : true,
			success : function(data) {

				$("#" + that.compId + "_reputation_img").attr("src",
						data.shopUrl);

				$("#" + that.compId + "_reputation_img_a").attr("href",
						ContextPath+"/dfFront/toShopPage/" + data.shopUuid + "/pc");
				$("#" + that.compId + "_reputation_name").attr("href",
						ContextPath+"/dfFront/toShopPage/" + data.shopUuid + "/pc");

				$("#" + that.compId + "_reputation_name_span").first()
						.text(data.shopName);

				$("#" + that.compId + "_lablename").first()
				.text(data.lableName);

				$("#" + that.compId + "_reputation_i").attr("uuid",
						data.shopUuid);

				$("#" + that.compId + "_reputation_i").attr("uuid",
						data.shopUuid);

				$("#" + that.compId + "_reputation_score").attr("style",
						"width:" + (data.scoreTotal) * 20 + "%");

				that.bindSomeEvent();

				Utils.ajaxLoadComplate(that);

			}

		})


	}
	else {

		that.bindSomeEvent();
		Utils.ajaxLoadComplate(that);


	}




}

Comps.Reputation.prototype.bindSomeEvent=function(){

	var that=this;

	$("#" + that.compId + "_reputation_i").click(function() {

		var uuid = $(this).attr("uuid");

		CompMessage.publish(that.topic,'',function(data){

			that.collectShop(uuid);
		});

	})


}


Comps.Reputation.prototype.collectShop=function(uuid){

		var that=this;
	var url = ContextPath+"/collectionShopComp/collectShop";
	

	 var returnMessage = $("#"+this.compId+"_returnMessage");
	    var collectNum = $("#"+this.compId+"_collectNum");
	    var collectUrl = $("#"+this.compId+"_collectUrl");

	$.ajax({
		type : "GET",
		url : url,
		data : {
			
			"type":"reputation",
			shopUuid : uuid,
			ranNum : Math.random()
		},
		dataType : "json",
		async : true,
		success : function(data) {



			var msg="";

			if(data.state=="1"){

				msg="收藏成功!";

			}
			else if (data.state=="2"){

				msg="收藏失败!";

			}

			else if (data.state=="3"){

				msg="您已经收藏过该店铺了!";

			}
			returnMessage.html(msg);
			
			collectNum.html(data.count);
			
			collectUrl.attr("href",ContextPath+that.collectShopUrl);
			
			 $("#"+that.compId+"_modal-collect-form").modal('show');
			Utils.ajaxLoadComplate(that);
		}

	})
}

//###########信誉##########



//###########简单信誉##########12

//组件定义
Comps.ReputationSample = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName=option.lableName;
}



Comps.ReputationSample.prototype.init = function() {

	var that = this;

	if (this.needAsyncInit) {

		$.ajax({
			type : "GET",
			url : ContextPath+"/reputationSampleComp/ajaxLoadData",
			data : {
				count : $("#count").val(),
				lableName : that.lableName
			},
			dataType : "json",
			async : true,
			success : function(data) {

				$("#" + that.compId + "_lablename").text(data.lableName);


				$("#" + that.compId + "_reputation_score").attr("style",
						"width:" + (data.scoreTotal) * 20 + "%");
								Utils.ajaxLoadComplate(that);

			}

		})


	}

	else {
		Utils.ajaxLoadComplate(that);

	}






}

//###########简单信誉##########


//###########分享组件##########13




//组件定义
Comps.ShareModel = function(option){
	this.compId = option.compId;
	this.imgSize = option.imgSize;
	this.needAsyncInit = option.needAsyncInit;
	this.lableName = option.lableName;
}


//初始化方法
Comps.ShareModel.prototype.init=function(){

	var that =this;


	if(this.needAsyncInit){

		$.ajax({
			type : "GET",
			url : ContextPath+"/shareComp/ajaxLoadData",
			data : {
				imgSize : that.imgSize,
				lableName : that.lableName
			},
			dataType : "json",
			async : true,
			success : function(data) {

				$("#" + that.compId + "_share_name").first().text(data.lableName);
				$("#" + that.compId + "_share_detail").attr("imgsize",
						data.imgSize);

				that.bindSomeEvent();
				Utils.ajaxLoadComplate(that);

			}

		})


	}

	else {
		that.bindSomeEvent();
		Utils.ajaxLoadComplate(that);


	}





}

//绑定事件
Comps.ShareModel.prototype.bindSomeEvent=function(){


	var that =this;



	window._bd_share_config = {
			"common" : {
				"bdSnsKey" : {},
				"bdText" : "",
				"bdMini" : "2",
				"bdMiniList" : false,
				"bdPic" : "",
				"bdStyle" : "0",
				"bdSize" : that.imgSize
			},
			"share" : {},
			"image2" : {
				"viewList" : [ "qzone", "tsina", "weixin" ],
				"viewText" : "分享到：",
				"viewSize" : "16"
			},
			"selectShare" : {
				"bdContainerClass" : null,
				"bdSelectMiniList" : [ "qzone", "tsina", "weixin" ]
			}
		};
		with (document)
			0[(getElementsByTagName('head')[0] || body)
					.appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='
					+ ~(-new Date() / 36e5)];



}


//###########分享组件##########


//###########店铺简介##########14


//组件定义
Comps.ShopInfo = function(option) {
	this.compId = option.compId;
	this.needAsyncInit = option.needAsyncInit;

	this.topic=option.topic;
}



Comps.ShopInfo.prototype.GetQueryString = function(name) {

	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;

}

// 初始化方法
Comps.ShopInfo.prototype.init = function() {




	var that = this;


	var productUuid=that.GetQueryString('productUuid');

	if(!productUuid){
		productUuid="";
	}

	if (this.needAsyncInit) {

		$.ajax({
					type : "GET",
					url : ContextPath+"/shopInfoComp/ajaxLoadData",
					data : {
						"productUuid":productUuid
					},
					dataType : "json",
					async : true,
					success : function(data) {

						$("#" + that.compId + "_shopinfo_name").text(
								data.shopName);

						$("#" +  that.compId + "_shopinfo_name").attr(
								"href",
								"/dfFront/toShopPage/" + data.shopUuid
										+ "/pc");
						$("#" +  that.compId + "_shopinfo_look").attr(
								"href",
								"/dfFront/toShopPage/" + data.shopUuid
										+ "/pc");
						$("#" +  that.compId + "_shopinfo_name").attr("title",
								data.shopName);

						$("#" +  that.compId + "_shopinfo_score").text(
								data.scoreTotal);

						$("#" +  that.compId + "_descScore").text(
								data.descScore);

						$("#" +  that.compId + "_attitudeScore").text(
								data.attitudeScore);

						$("#" +  that.compId + "_speedScore").text(
								data.speedScore);







						$("#" +  that.compId + "_shopinfo_attention").attr(
								"uuid", data.shopUuid);


						that.bindSomeEvent();
						Utils.ajaxLoadComplate(that);

					}

				})

	}

	else {
		that.bindSomeEvent();
		Utils.ajaxLoadComplate(that);


	}

}

Comps.ShopInfo.prototype.collectShop=function(uuid){

	var that=this;
	var url = ContextPath+"/collectionShopComp/collectShop";
	

	 var returnMessage = $("#"+this.compId+"_returnMessage");
	    var collectNum = $("#"+this.compId+"_collectNum");
	    var collectUrl = $("#"+this.compId+"_collectUrl");

	$.ajax({
		type : "GET",
		url : url,
		data : {
			
			"type":"reputation",
			shopUuid : uuid,
			ranNum : Math.random()
		},
		dataType : "json",
		async : true,
		success : function(data) {



			var msg="";

			if(data.state=="1"){

				msg="收藏成功!";

			}
			else if (data.state=="2"){

				msg="收藏失败!";

			}

			else if (data.state=="3"){

				msg="您已经收藏过该店铺了!";

			}
			returnMessage.html(msg);
			
			collectNum.html(data.count);
			
			collectUrl.attr("href",ContextPath+that.collectShopUrl);
			
			 $("#"+that.compId+"_modal-collect-form").modal('show');
			Utils.ajaxLoadComplate(that);
		}

	})


}

//绑定事件
Comps.ShopInfo.prototype.bindSomeEvent=function(){

	var that = this;
	$("#" + that.compId + "_shopinfo_attention").click(function() {

		var uuid = $(this).attr("uuid");


	CompMessage.publish(that.topic,'',function(data){

			that.collectShop(uuid);
		});

	})

}



//###########楼层组件##########15


// 组件定义
Comps.FloorStyle = function(option) {
	this.compId = option.compId;
	this.showtype = option.showtype;
}


Comps.FloorStyle.prototype.init = function() {

	var that =this;

	if (!this.showtype) {

		$(".m-fixfloor").hide();



	}

	Utils.ajaxLoadComplate(that);


}



//###########楼层组件##########









